/***************************************************************
*  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
*  All rights reserved.
*
*  This file is part of the GroupMe! Project. Source code of 
*  this project is closed and redistribution of this code is
*  prohibited. 
*  
*  Contact: http://www.groupme.net
*
*  This copyright notice MUST APPEAR in all copies of the file!
***************************************************************/
package net.groupme.search.strategy.model;

import java.util.Comparator;

/**
 * created on Jul 6, 2007
 * 
 * This comparator compares identifiables by their label (e.g. Air < Zoo, ..)
 * 
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: fabian $
 * 
 * @version $Revision: 1.1 $ $Date: 2007-07-06 15:07:07 $
 */
public class WeightedIdentifiableComparatorByLabel implements Comparator<AbstractWeightedIdentifiable> {

	/* (non-Javadoc)
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	public int compare(AbstractWeightedIdentifiable a, AbstractWeightedIdentifiable b) {
		if(a.getIdentifiable().getLabel() == null || b.getIdentifiable().getLabel() == null){
			return 0;
		}
		return a.getIdentifiable().getLabel().compareTo(b.getIdentifiable().getLabel());
	}

}
